package com.kfm.jdbc.day0329;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo07 {


    public static void main(String[] args) {
        try(FileInputStream fileInputStream = new FileInputStream("d:\\io\\hxx.png");
            FileOutputStream fos = new FileOutputStream("d:\\io\\b.png");){

//            fileInputStream.transferTo(fos);

            byte[] bytes = new byte[1024];
            int len = 0;
            while ((len = fileInputStream.read(bytes)) != -1) {
                fos.write(bytes, 0, len);
            }
            fos.flush();

        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
